home *** CD-ROM | disk | FTP | other *** search
/ SunSoft Catalyst CDWARE 1996 May to August / Catalyst CDWARE 1996 May to August.iso / cdware
Text File  |  1996-04-05  |  12KB  |  383 lines

  1. #!/bin/sh 
  2. #
  3. # The following CDware script launches httpd, waissearch, and Netscape 
  4. # on Solaris SPARC, Solaris x86, and SunOS
  5.  
  6. # Author: Marc Sacoolas (marc.sacoolas@sun.com)
  7. #   Date: April 4, 1995
  8. # below is for the cgi-scripts
  9. DISC_NAME=CDware_May-1996
  10. # below is for everything else
  11. disc_name="CDware";disc_rest="CDware May 1996"
  12. export disc_name disc_rest
  13.  
  14. # initialize variables
  15.  
  16. dir_exist=0
  17. echo ""
  18. echo "          Catalyst $disc_name initializing ..."
  19. echo ""
  20.                         
  21.  
  22.  
  23. # set CDMOUNT to path from the command line arguements
  24. CDMOUNT=`expr \
  25.         $0'/' : '\(/\)[^/]*//*$' \
  26.         \| $0'/' : '\(.*[^/]\)//*[^/][^/]*//*$' \
  27.         \| .`
  28. # if command line path is current directory then set CDMOUNT to pwd
  29. # CDMOUNT cannot be set to . because other programs/scripts
  30. # need the absolute path in CD_MOUNT
  31. if [ "$CDMOUNT" = "." ]; then
  32.         CDMOUNT=`pwd`
  33. fi
  34. CD_MOUNT=$CDMOUNT
  35.  
  36. export CD_MOUNT PID_CDWARE PID_CATALOG dir_exist
  37.  
  38. if [ -h $HOME/.netscape/lock ]; then
  39.     echo '\07'
  40.         echo "It looks like you are currently running Netscape Navigator."
  41.         echo "You should quit it before running $disc_rest!"
  42.         echo "Press <RETURN> to continue or <CTRL> C to abort..."
  43.         read a
  44. fi
  45.  
  46.  
  47.  
  48. #
  49. # os type and arch
  50. #
  51. check_os()
  52. {
  53.         os_ver="`/bin/uname -r | /bin/grep 5\[.]`"
  54.  
  55.         export os_ver
  56.  
  57.         if [ -n "$os_ver" ]; then
  58. # must be running Solaris 2.x
  59.                 machine_type="`/bin/uname -m`"
  60.                 os_type="`/bin/uname -r`"
  61.                 if [ "$machine_type" = "i86pc" ]; then
  62.                         OS_TYPE=""
  63.                         CDWARE_ENV=Solaris_x86
  64.                 else
  65. # must be on a SPARCarchitecture-based machine
  66.                         bcp="`/bin/pkginfo | /bin/grep SUNWbcp`"
  67. # check for bcp and set CDWARE_ENV accordingly???
  68.                         CDWARE_ENV=Solaris_2
  69.                 fi
  70.         else
  71. # must be running Solaris 1.x
  72.                 GUI=.products/bin/Solaris_1/cdmanager
  73.                 GUI_BIN=cdmgr
  74.                 CDWARE_ENV=Solaris_1
  75.         fi
  76.  
  77. #
  78. # CDWARE_HOME used by screendemo, slidecacher, and seaudio
  79. #
  80. CDWARE_HOME=$CDMOUNT/.products/bin/$CDWARE_ENV$OS_TYPE
  81.  
  82. export GUI CDWARE_ENV CDWARE_HOME OS_TYPE
  83. }
  84. # print out legal text as required by the lawyers
  85. echo " "    
  86. cat $CD_MOUNT/.products/$disc_name/legal.txt
  87.  
  88.  
  89. check_os
  90.  
  91.  
  92. if [ "$OPENWINHOME" != "" ]; then
  93.     OPENWINHOME="/usr/openwin"; export OPENWINHOME    
  94. fi
  95.  
  96. export LD_LIBRARY_PATH HOTJAVA_HOME CLASSPATH PATH
  97.  
  98. LD_LIBRARY_PATH=$CD_MOUNT/.products/.lib/$CDWARE_ENV/lib:/usr/openwin/lib:/usr/lib
  99. CLASSPATH=./:$CD_MOUNT/.products/.bin/gui/$CDWARE_ENV:$CD_MOUNT/.products/.bin/gui//classes:$CD_MOUNT/.products/$disc_name/classes
  100. if [ "$CDWARE_ENV" = "Solaris_1" ]; then
  101. PATH=/tmp/httpd/.cgi-bin:/usr/ucb:$OPENWINHOME/bin:/usr/bin:/usr/sbin:$PATH
  102. XNLSPATH=$CD_MOUNT/.products/.bin/gui/$CDWARE_ENV/nls
  103. XKEYSYMDB=$CD_MOUNT/.products/.bin/gui/$CDWARE_ENV
  104. else
  105. PATH=/tmp/httpd/.cgi-bin:/usr/bin:$OPENWINHOME/bin:/usr/sbin:$PATH
  106. fi
  107.  
  108. # play welcome audio clip
  109.  
  110. if [ $CDWARE_ENV != "Solaris_1" ]; then
  111.     audioplay -i $CD_MOUNT/.products/$disc_name/sounds/welcome.au&
  112. else
  113.     cat $CD_MOUNT/.products/$disc_name/sounds/welcome.au > /dev/audio&
  114. fi
  115.  set the dir where all the companies live
  116.  
  117. PRODUCT_DIR=$CD_MOUNT/.products
  118. export PRODUCT_DIR 
  119.  
  120. export WWW_HOME
  121.  
  122. # if "/tmp/.wais" symlink is not already there, then
  123. # create link for wais-src and wais on CDrom
  124.  
  125. if [ ! -h /tmp/.wais ]; then
  126.     ln -s $PRODUCT_DIR/.wais /tmp
  127. fi
  128.  
  129. # move only needed files and symlink for "file" URLs, if necessary
  130.  
  131. if [ ! -d /tmp/httpd ]; then
  132.     mkdir /tmp/httpd
  133.     mkdir /tmp/httpd/bin
  134.     mkdir /tmp/httpd/conf
  135.     mkdir /tmp/httpd/cache
  136.     cp -r $CD_MOUNT/.products/.bin/httpd/conf /tmp/httpd&
  137.     cp -r $CD_MOUNT/.products/.bin/httpd/logs /tmp/httpd&
  138.  
  139.     ln -s $PRODUCT_DIR /tmp/httpd 
  140. fi
  141.  
  142. # create temp mailcap file
  143.     key=$
  144.     #MAILCAP=/tmp/.mailcap
  145.     #export MAILCAP
  146.     echo "application/x-key-sh; /bin/sh %s " > /tmp/httpd/.$disc_name
  147.     echo "application/postscript; $OPENWINHOME/bin/pageview %s " >> /tmp/httpd/.$disc_name
  148.  
  149. # needed srm.conf doc for httpd conf
  150.  
  151. echo ""
  152. echo "     NCSA World Wide Web server initializing ..."        
  153. echo ""
  154. echo "        Portions developed at the National Center"
  155. echo "        for Supercomputing Applications at the"
  156. echo "        University of Illinois at Urbana-Champaign."    
  157. echo ""    
  158.  
  159. if [ ! -h /tmp/httpd/.cgi-bin ]; then
  160.     ln -s $PRODUCT_DIR/.bin/httpd/$CDWARE_ENV /tmp/httpd/.cgi-bin
  161. fi
  162.  
  163. # if slower machine, use non-imaged mapped page
  164.  
  165. if [ "`/bin/uname -m | sed 's/sun4//g'" = "c" -o "`/bin/uname -m | sed 's/i86//g'" = "pc" -a "$1" != "fast" -o "$1" = "slow" ]; then
  166.     ln -s $PRODUCT_DIR/$disc_name/index.4c /tmp/httpd/index.html
  167.     #WWW_HOME=$CDMOUNT/.products/$disc_name/index.4c
  168.     WWW_HOME=/tmp/httpd/.products/CDware/index.4c
  169. else
  170.     ln -s $PRODUCT_DIR/$disc_name/index.4x /tmp/httpd/index.html
  171.     #WWW_HOME=$CDMOUNT/.products/$disc_name/index.4x
  172.     WWW_HOME=/tmp/httpd/.products/CDware/index.4x
  173. fi
  174.  
  175.  
  176.  
  177. #wais_conf()
  178.  
  179. #{
  180.  
  181. echo "DocumentRoot $CD_MOUNT/.products" >> /tmp/httpd/conf/srm.conf
  182. echo 'UserDir public_html' >> /tmp/httpd/conf/srm.conf
  183. echo 'HeaderName public_html' >> /tmp/httpd/conf/srm.conf
  184. echo 'DirectoryIndex index.html' >> /tmp/httpd/conf/srm.conf
  185. echo 'FancyIndexing on' >> /tmp/httpd/conf/srm.conf
  186.  
  187. echo 'AddType application/x-key-sh .sh' >> /tmp/httpd/conf/srm.conf
  188. echo 'AddIconByType (TXT,/icons/text.xbm) text/*' >> /tmp/httpd/conf/srm.conf
  189. echo 'AddIconByType (IMG,/icons/image.xbm) image/*' >> /tmp/httpd/conf/srm.conf
  190. echo 'AddIconByType (SND,/icons/sound.xbm) audio/*' >> /tmp/httpd/conf/srm.conf
  191. echo 'AddIcon /icons/movie.xbm .mpg .qt' >> /tmp/httpd/conf/srm.conf
  192. echo 'AddIcon /icons/binary.xbm .bin' >> /tmp/httpd/conf/srm.conf
  193.  
  194. echo 'AddIcon /icons/back.xbm ..' >> /tmp/httpd/conf/srm.conf
  195. echo 'AddIcon /icons/menu.xbm ^^DIRECTORY^^' >> /tmp/httpd/conf/srm.conf
  196. echo 'AddIcon /icons/blank.xbm ^^BLANKICON^^' >> /tmp/httpd/conf/srm.conf
  197.  
  198. echo 'DefaultIcon /icons/unknown.xbm' >> /tmp/httpd/conf/srm.conf
  199.  
  200. echo 'ReadmeName README' >> /tmp/httpd/conf/srm.conf
  201. echo 'HeaderName HEADER' >> /tmp/httpd/conf/srm.conf
  202.  
  203. echo 'IndexIgnore */.??* *~ *# */HEADER* */README*' >> /tmp/httpd/conf/srm.conf
  204.  
  205. echo 'AccessFileName .htaccess' >> /tmp/httpd/conf/srm.conf
  206.  
  207. echo 'DefaultType text/plain' >> /tmp/httpd/conf/srm.conf
  208.  
  209. echo "ScriptAlias /.categories/ /tmp/httpd/.cgi-bin/show.pl" >> /tmp/httpd/conf/srm.conf
  210.  
  211. echo "ScriptAlias /cgi-bin/ $CD_MOUNT/.products/.bin/httpd/cgi-bin/" >> /tmp/httpd/conf/srm.conf
  212. #echo "Alias /docs/ $CD_MOUNT/.products/$disc_name/docs/" >> /tmp/httpd/conf/srm.conf
  213.  
  214. # generate access.conf file
  215.  
  216. echo '<Directory /tmp/httpd/>' >> /tmp/httpd/conf/access.conf
  217. echo 'Options Indexes FollowSymLinks' >> /tmp/httpd/conf/access.conf
  218.  
  219.  
  220. echo '</Directory>' >> /tmp/httpd/conf/access.conf
  221.  
  222. echo "<Directory $CD_MOUNT/.products/*>" >> /tmp/httpd/conf/access.conf
  223.  
  224. echo 'Options Indexes FollowSymLinks ExecCGI' >> /tmp/httpd/conf/access.conf
  225.  
  226. echo 'AllowOverride All' >> /tmp/httpd/conf/access.conf
  227.  
  228. echo '<Limit GET>' >> /tmp/httpd/conf/access.conf
  229. echo 'order allow,deny' >> /tmp/httpd/conf/access.conf
  230. echo 'allow from all' >> /tmp/httpd/conf/access.conf
  231. echo '</Limit>' >> /tmp/httpd/conf/access.conf
  232.  
  233. echo '</Directory>' >> /tmp/httpd/conf/access.conf
  234.  
  235.  
  236.  
  237. # generate  imagemap.conf
  238.  
  239. #echo "     :     " > /tmp/httpd/conf/imagemap.conf
  240.  
  241. # append ServerName to http file for disc specification
  242.  
  243. echo "ServerName $DISC_NAME" >> /tmp/httpd/conf/httpd.conf-dist
  244.  
  245. # make link to *real* cgi-bin dirctory
  246.  
  247.  
  248. # Check to see if the user is root, if so, change to
  249. # "-nobody" 
  250. #
  251.  
  252. USER=`/usr/ucb/whoami`
  253. if [ "$USER" = "root" ]; then
  254.  
  255.         echo "User nobody" >>/tmp/httpd/conf/httpd.conf-dist
  256.  
  257.         if [ "$CDWARE_ENV" = "Solaris_1" ]; then 
  258.         echo "Group nogroup" >>/tmp/httpd/conf/httpd.conf-dist
  259.         else
  260.         echo "Group nobody" >>/tmp/httpd/conf/httpd.conf-dist
  261.         fi 
  262. fi
  263. # launch wais search deamen
  264. echo "     Launching Catalyst Catalog WAIS server ..."
  265. echo ""
  266. echo "          Copyright (c) MCNC, Clearinghouse for Networked"
  267. echo "          Information Discovery and Retrieval, 1993."
  268.  
  269. export PID_CDWARE PID_CATALOG
  270.  
  271. $CD_MOUNT/.products/.bin/httpd/cgi-bin/waisserver -p 7998 -d $CD_MOUNT/.products/.wais/wais >/tmp/waisserver.log &
  272.  
  273. PID_CDWARE=$!
  274. $CD_MOUNT/.products/.bin/httpd/cgi-bin/waisserver -p 7997 -d $CD_MOUNT/.products/.wais/wais_$disc_name >/tmp/waisserver.log &
  275.  
  276. PID_CATALOG=$!
  277.  
  278.  
  279. #launch httpd
  280.  
  281. $CD_MOUNT/.products/.bin/httpd/cgi-bin/httpd -f /tmp/httpd/conf/httpd.conf-dist
  282. #}
  283.  
  284. #wais_conf&
  285.  
  286.  
  287. echo ""
  288. echo "        NOTE: If you have internet access through" 
  289. echo "        a fire-wall, you may have to set a \"proxy\""
  290. echo "        server under \"Network options\" in Netscape." 
  291.  
  292.  
  293. #WHERE="`/usr/bin/which netscape`"
  294. #echo "WHERE="$WHERE
  295. #Looks for a version of Netscape later than 2.01
  296. #NETSCAPE_FULL_VERSION="`netscape -version 2>&1|grep -v found`"
  297. #echo "FULL_VERSION="$NETSCAPE_FULL_VERSION
  298. export PATH
  299. PATH=$PATH:$CD_MOUNT/.products/.bin/gui/$CDWARE_ENV
  300. #which netscape
  301. NETSCAPE_VERSION="`netscape -version 2>&1| /tmp/httpd/.cgi-bin/perl -n -e 's?\D*([0-9.]*).*?\1? ? print : print "none"'`"
  302. #echo "VERSION="$NETSCAPE_VERSION
  303. #NETSCAPE_VERSION="2.02"
  304.  
  305. POST_VERSION_201=`echo $NETSCAPE_VERSION|/tmp/httpd/.cgi-bin/perl -n -e '/2\.(\d[2-9]|[1-9]\d)/ || /[3-9]\./ ? print "post" : print "ant"'`
  306. #echo "POST_VERSION_201="$POST_VERSION_201
  307. if [ $POST_VERSION_201 = "post" ];then
  308.     #echo "BEF="$NETSCAPE_VERSION
  309.     #if [ ! -x $NETSCAPE_VERSION ];then
  310.         #echo ""
  311.         #echo " A version of Netscape Navigator older than 2.01 has been detected on your machine. The Catalyst CDware CD will use Netscape Navigator 2.01 on the CD."
  312.         #echo ""
  313.     #fi
  314. #else
  315.     #echo "AFTER="$NETSCAPE_VERSION
  316.     echo
  317.     echo "WARNING: a version of Netscape Navigator 2.01 or later has been detected in your PATH!"
  318.     echo "Netscape Navigator "$NETSCAPE_VERSION" will be used for the Catalyst CDware CD"
  319.     echo ""
  320.     #echo $PATH
  321.     NETSCAPE_CATALYST=`echo $PATH|/tmp/httpd/.cgi-bin/perl -n -e '
  322.         @DIRS=split(/:/);
  323.         foreach $dir (@DIRS) {
  324.             if (-x "$dir/netscape" && -f _) {
  325.                 print "$dir/netscape\n";
  326.                 last;
  327.             }
  328.         }'`
  329.     export NETSCAPE_CATALYST
  330.     #echo "NETSCAPE_CATALYST="$NETSCAPE_CATALYST
  331. fi
  332.  
  333. if [ -d $HOME/.netscape ]; then
  334.    perl -p -i.SunCD -e 's?^NO_PROXY:.*$?NO_PROXY: localhost?;
  335.                 s?^SHOW_DIRECTORY_BUTTONS:.*$?SHOW_DIRECTORY_BUTTONS:   False?;
  336.                 s?^SHOW_URL:.*$?SHOW_URL:       True?;
  337.                 s?^AUTOLOAD_IMAGES:.*$?AUTOLOAD_IMAGES: True?;
  338.                 s?^MIME_TYPES:.*$?MIME_TYPES:   /tmp/httpd/conf/mime.types?;
  339.                 s?^PERSONAL_MIME_TYPES:.*$?PERSONAL_MIME_TYPES: /tmp/httpd/conf/mime.types?;        
  340.                 s?^MAILCAP:.*$?MAILCAP: /tmp/httpd/.CDware?;
  341.                 s?^PERSONAL_MAILCAP:.*$?PERSONAL_MAILCAP:       /tmp/httpd/.CDware?;        
  342.                 s?^HOME_DOCUMENT:.*$?HOME_DOCUMENT:     file:///tmp/httpd/.products/CDware/index.4c?;
  343.                 s?^DISABLE_JAVA:.*$?DISABLE_JAVA:       False?;
  344.         s?^SHOW_TOOLBAR:.*$?SHOW_TOOLBAR:         True?;
  345.         s?^WARN_ENTER_SECURE:.*$?WARN_ENTER_SECURE:      False?;
  346.         s?^WARN_LEAVE_SECURE:.*$?WARN_LEAVE_SECURE:      False?;
  347.         s?^WARN_MIXED_SECURE:.*$?WARN_MIXED_SECURE:      False?;
  348.         s?^WARN_SUBMIT_INSECURE:.*$?WARN_SUBMIT_INSECURE:   False?;
  349.         s?^SHOW_URL:.*$?SHOW_URL:             False?;
  350.         s?^SHOW_DIRECTORY_BUTTONS:.*$?SHOW_DIRECTORY_BUTTONS:  False?;
  351.         s?^AUTOLOAD_IMAGES:.*$?AUTOLOAD_IMAGES:      True?;
  352.         s?^FTP_FILE_INFO:.*$?FTP_FILE_INFO:        True?;
  353.         s?^SHOW_SECURITY_BAR:.*$?SHOW_SECURITY_BAR    True?;
  354.                 s?^FONT_SPEC:[  ]*([^-]*)-([^-]*)-([^-]*)-(.*)$?FONT_SPEC: \1-\2-140-\4?;
  355.    ' $HOME/.netscape/preferences
  356.  
  357.   dir_exist=1
  358. else
  359.   cp -r $CD_MOUNT/.products/.bin/gui/.netscape $HOME
  360.   dir_exist=0
  361. fi
  362.  
  363.  
  364. echo ""
  365. echo "Catalyst $disc_name is starting ..."
  366. echo ""
  367. echo "Please note the following:" 
  368. echo "--------------------------" 
  369. echo "- To run many of the slide shows there must be at least 5 megabytes" 
  370. echo "  of available disk space in /tmp.  Please verify the available disk" 
  371. echo "  space in /tmp before running the slide shows." 
  372. echo " " 
  373. echo " " 
  374.  
  375. ##$CD_MOUNT/.products/.bin/httpd/$CDWARE_ENV/welcome 120 &
  376.  
  377. # cleanup previous line, if any
  378. perl -nei 'print unless $_ =~ "application/x-spam-sh; /bin/sh %s"' $HOME/.mailcap > /tmp/httpd/.mailcap; cp /tmp/httpd/.mailcap $HOME/.mailcap
  379.  
  380. $CD_MOUNT/.products/.bin/finish.sh &
  381. sleep 120 
  382. exit 0
  383.